//引入request.js
const {
    request
} = require('./request')

//需要调用的业务接口
module.exports = {

    // 登录和注册的api
    wxszhuceapi(code) {
        return request('/user/wxapp/authorize', 'POST', {
            code: code
        })
    },

    // 检测token是否过期的api
    checkToken(token) {
        return request('/user/check-token', 'GET', {
            token
        })
    },

    // 用户详情的api
    getuserapi(token) {
        return request('/user/detail', 'GET', {
            token
        })
    },
    // 更新用户
    updateuserinfo(data = {}) {
        return request('/user/modify', 'POST', data)
    },


    //启动图
    getpag(type = 'app') {
        return request('/banner/list', 'GET', {
            type: 'app'
        })
    },
    //轮播图
    getBanner(type = 'index') {
        return request('/banner/list', 'GET', {
            type: 'index'
        })
    },
    // 导航
    Fen: () => {
        return request('shop/goods/category/all', 'GET')
    },
    // 公告
    gonggao() {
        return request('notice/last-one', 'GET')
    },
    // 限时秒杀
    xianshi() {
        return request('shop/goods/list/v2', 'POST', {
            'miaosha': true
        })
    },
    // 爆品推荐
    baopin() {
        return request('shop/goods/list/v2', 'POST', {
            'recommendStatus': '1'
        })
    },
    // 全民拼团
    quan() {
        return request('shop/goods/list/v2', 'POST', {
            'pingtuan': true
        })
    },
    // 商品列表
    shang: (data) => {
        return request('shop/goods/list/v2', 'POST', data)
    },
    // 搜索页面
    Searchs: (data) => {
        return request('shop/goods/list/v2', 'POST', data)
    },
    // 排序
    Sheng: (data) => {
        return request('shop/goods/list/v2', 'POST', data)
    },
    // 分类页面数据
    fenlei() {
        return request('shop/goods/category/all', 'GET')
    },
    // 商品详情
    Detail: (data) => {
        return request('shop/goods/detail', 'GET', data)
    },

    //  获取商品配件
    PeiShop(data) {
        return request('shop/goods/goodsAddition', 'GET', data)
    },

    // 加入购物车
    GoShop(data = {}) {
        return request('shopping-cart/add', 'POST', data)
    },

    // 商品价格
    ShopPrice: (data) => {
        return request('shop/goods/price', 'POST', data)
    },

    // 购物车列表
    ShopList: (data) => {
        return request('shopping-cart/info', 'GET', data)
    },
    // 购物车修改选中状态
    ShopCheck: (data) => {
        return request('shopping-cart/select', 'POST', data)
    },
    // 删除购物车
    ShopDel: (data) => {
        return request('shopping-cart/remove', 'POST', data)
    },
    // 修改购物车数量
    ShopChange: (data) => {
        return request('shopping-cart/modifyNumber', 'POST', data)
    },
}